Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drop addr and port from Endpoint.Latest map #2581

Merged
merged 1 commit into from
Jun 12, 2017
Merged

Conversation

rade
Copy link
Member

@rade rade commented Jun 10, 2017

The information is constant and already present in the id, so we can extract it from there.

That reduces the report size and improves report encoding/decoding performance. It should reduce memory usage too and improve report merging performance too.

NB: Probes with this change are incompatible with old apps.

the information is constant and already present in the id, so we can
extract it from there.

That reduces the report size and improves report encoding/decoding
performance. It should reduce memory usage too and improve report
merging performance too.

NB: Probes with this change are incompatible with old apps.
@rade rade requested a review from 2opremio June 10, 2017 18:51
@rade
Copy link
Member Author

rade commented Jun 10, 2017

I grabbed a recent prod report and then did this...

$ jq 'del(.Endpoint.nodes[].latest.addr,.Endpoint.nodes[].latest.port)' prod-on-dev-report.json > prod-on-dev-report-trimmed.json
$ extras/copyreport/copyreport prod-on-dev-report.json prod-on-dev-report.msgpack.gz
$ extras/copyreport/copyreport prod-on-dev-report-trimmed.json prod-on-dev-report-trimmed.msgpack.gz
$ ls -s prod-on-dev-report*.msgpack.gz
2788 prod-on-dev-report.msgpack.gz
2364 prod-on-dev-report-trimmed.msgpack.gz
$ bc <<< "scale=3;2364/2788"
.847
$ time GOMAXPROCS=1 extras/copyreport/copyreport prod-on-dev-report.msgpack.gz /tmp/report.msgpack.gz

real	0m1.637s
user	0m1.584s
sys	0m0.052s
$ time GOMAXPROCS=1 extras/copyreport/copyreport prod-on-dev-report-trimmed.msgpack.gz /tmp/report.msgpack.gz

real	0m1.449s
user	0m1.380s
sys	0m0.052s
$ bc <<< "scale=3;1.449/1.637"
.885

So report size is down 15% and encode/decode performance is up 12%.

@rade
Copy link
Member Author

rade commented Jun 10, 2017

To check that I didn't break anything, I ran

$ prog/scope --mode=app --weave=false --app.collector=file:/home/matthias/tmp/prod-on-dev-report.json
$ for r in processes containers pods services hosts; do \
    curl -s http://localhost:4040/api/topology/$r | jq -S '.' > $r.json; \
  done
$ prog/scope --mode=app --weave=false --app.collector=file:/home/matthias/tmp/prod-on-dev-report-trimmed.json
$ for r in processes containers pods services hosts; do \
    curl -s http://localhost:4040/api/topology/$r | jq -S '.' > $r-trimmed.json; \
  done
$ for r in processes containers pods services hosts; do \
    diff -q $r.json $r-trimmed.json
  done

@2opremio
Copy link
Contributor

Good one!

@rade rade merged commit 45aee2b into master Jun 12, 2017
@rade rade deleted the trim-endpoint-latest branch July 5, 2017 13:08
@2opremio 2opremio mentioned this pull request Feb 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants